import { AutocompleteInteraction, ApplicationCommandOptionChoiceData, CommandInteraction, InteractionContextType, ApplicationIntegrationType, InteractionReplyOptions, MessagePayload, User, GuildBasedChannel, GuildMember, Role, Attachment, ClientOptions, ShardingManagerOptions, PermissionsString } from 'discord.js';
import { IncomingMessage, ServerResponse } from 'node:http';
import { LogDrain, LogLevel } from './core/logger.js';

interface Command {
    autocomplete?: (interaction: AutocompleteInteraction) => Promise<ApplicationCommandOptionChoiceData<string | number>[]>;
    config?: CommandConfig;
    default: (interaction: CommandInteraction, options: unknown) => unknown | Promise<unknown>;
}
interface CommandConfig extends BaseConfig {
    contexts?: CommandContext[];
    defaultMemberPermissions?: string | number | bigint;
    /** @deprecated Use `contexts` instead */
    dmPermission?: boolean;
    descriptionLocalizations?: Record<string, string>;
    integrationTypes?: CommandIntegrationType[];
    nameLocalizations?: Record<string, string>;
    options?: readonly CommandOption[];
    sage?: false | SageOptions;
    timeout?: number;
}
type CommandContext = 'BotDM' | 'Guild' | 'PrivateChannel' | InteractionContextType;
interface CommandEntry extends CommandConfig {
    subcommands?: Record<string, CommandEntry>;
}
type CommandIntegrationType = 'GuildInstall' | 'UserInstall' | ApplicationIntegrationType;
interface CommandOption {
    autocomplete?: boolean;
    choices?: ApplicationCommandOptionChoiceData<string | number>[];
    description?: string;
    descriptionLocalizations?: Record<string, string>;
    max?: number;
    min?: number;
    name: string;
    nameLocalizations?: Record<string, string>;
    required?: boolean;
    type?: keyof CommandOptionTypes;
}
type CommandResult = string | InteractionReplyOptions | MessagePayload | void;
type CommandOptionTypes = {
    string: string;
    integer: number;
    number: number;
    boolean: boolean;
    user: User;
    channel: GuildBasedChannel;
    member: GuildMember;
    role: Role;
    attachment: Attachment;
    mention: GuildMember | Role;
};
type CommandOptions<ConfigType extends CommandConfig> = {
    [K in NonNullable<ConfigType['options']>[number] as K['name']]: K extends {
        required: true;
        type: infer TypeName;
    } ? TypeName extends keyof CommandOptionTypes ? CommandOptionTypes[TypeName] : string : K extends {
        type: infer TypeName;
    } ? TypeName extends keyof CommandOptionTypes ? CommandOptionTypes[TypeName] | undefined : string | undefined : K extends {
        required: true;
    } ? string : string | undefined;
};
declare const _default$5: {};

type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
interface RoboRequest {
    req: IncomingMessage;
    body?: unknown;
    method: HttpMethod;
    query: Record<string, unknown>;
    params: Record<string, unknown>;
}
interface RoboReply {
    res: ServerResponse;
    code: (statusCode: number) => RoboReply;
    send: (data: string) => RoboReply;
    header: (name: string, value: string) => RoboReply;
    hasSent: boolean;
}
type RouteHandler = (req: RoboRequest, res: RoboReply) => unknown | Promise<unknown>;
interface Api {
    default: (request: RoboRequest, reply: RoboReply) => unknown | Promise<unknown>;
}
interface ApiEntry extends BaseConfig {
    subroutes?: Record<string, ApiEntry>;
}
declare const _default$4: {};

interface Config {
    clientOptions?: ClientOptions;
    defaults?: {
        contexts?: CommandContext[];
        defaultMemberPermissions?: string | number | bigint;
        dev?: boolean;
        help?: boolean;
        integrationTypes?: CommandIntegrationType[];
    };
    excludePaths?: string[];
    experimental?: {
        buildDirectory?: string;
        disableBot?: boolean;
        incrementalBuilds?: boolean;
        shard?: boolean | ShardingManagerOptions;
        /** @deprecated Use `integrationTypes` in command config instead */
        userInstall?: boolean;
    };
    flashcore?: {
        keyv?: unknown;
    };
    invite?: {
        autoPermissions?: boolean;
        permissions?: PermissionsString[] | number;
        scopes?: Scope[];
    };
    logger?: {
        drain?: LogDrain;
        enabled?: boolean;
        level?: LogLevel;
    };
    plugins?: Plugin[];
    roboplay?: {
        node?: '18' | '20' | 'latest';
    };
    sage?: false | SageOptions;
    seed?: {
        description?: string;
    };
    timeouts?: {
        autocomplete?: number;
        commandDeferral?: number;
        commandRegistration?: number;
        lifecycle?: number;
    };
    type?: 'plugin' | 'robo';
    /** How often to check for updates to Robo.js in seconds. Default: 1 hour */
    updateCheckInterval?: number;
    watcher?: {
        ignore?: string[];
    };
}
type Scope = 'identify' | 'email' | 'connections' | 'guilds' | 'guilds.join' | 'guilds.members.read' | 'gdm.join' | 'rpc' | 'rpc.notifications.read' | 'rpc.voice.read' | 'rpc.voice.write' | 'rpc.activities.write' | 'bot' | 'webhook.incoming' | 'messages.read' | 'applications.builds.upload' | 'applications.builds.read' | 'applications.commands' | 'applications.store.update' | 'applications.entitlements' | 'activities.read' | 'activities.write' | 'relationships.read' | 'voice' | 'dm_channels.read' | 'role_connections.write' | 'applications.commands.permissions.update';
declare const _default$3: {};

interface Event {
    default: (...data: unknown[]) => unknown | Promise<unknown>;
}
interface EventConfig extends BaseConfig {
    frequency?: 'always' | 'once';
}
declare const _default$2: {};

interface Manifest {
    __README: string;
    __robo: {
        config: Config | null;
        language: 'javascript' | 'typescript';
        mode: string;
        seed?: {
            description?: string;
        };
        type: 'plugin' | 'robo';
        updatedAt?: string;
        version?: string;
    };
    api: Record<string, ApiEntry>;
    commands: Record<string, CommandEntry>;
    context: {
        message: Record<string, ContextEntry>;
        user: Record<string, ContextEntry>;
    };
    events: Record<string, EventConfig[]>;
    permissions?: PermissionsString[] | number;
    middleware?: MiddlewareEntry[];
    scopes?: Scope[];
}
declare const _default$1: {};

interface ContextConfig extends BaseConfig {
    contexts?: CommandContext[];
    defaultMemberPermissions?: string | number | bigint;
    /** @deprecated Use `contexts` instead */
    dmPermission?: boolean;
    integrationTypes?: CommandIntegrationType[];
    nameLocalizations?: Record<string, string>;
    sage?: false | SageOptions;
    timeout?: number;
}
type ContextEntry = ContextConfig;
interface Context {
    config?: ContextConfig;
    default: (...data: unknown[]) => unknown | Promise<unknown>;
}
interface FlashcoreAdapter<K = string, V = unknown> {
    clear(): Promise<boolean> | Promise<void> | boolean | void;
    delete(key: K): Promise<boolean> | boolean;
    get(key: K): Promise<V | undefined> | V | undefined;
    set(key: K, value: V): Promise<boolean> | boolean;
    has(key: K): Promise<boolean> | boolean;
}
interface HandlerRecord<T = unknown> {
    auto?: boolean;
    description?: string;
    handler: T;
    key: string;
    module?: string;
    path: string;
    plugin?: {
        name: string;
        path: string;
    };
    type: 'api' | 'command' | 'context' | 'event' | 'middleware';
}
interface MiddlewareData {
    payload: unknown[];
    record: HandlerRecord;
}
interface MiddlewareResult {
    abort?: boolean;
}
interface Middleware {
    default: (data: MiddlewareData) => void | MiddlewareResult | Promise<MiddlewareResult>;
}
type MiddlewareEntry = BaseConfig;
interface PackageJson {
    name: string;
    version: string;
    description?: string;
    scripts?: Record<string, string>;
    dependencies?: Record<string, string>;
    devDependencies?: Record<string, string>;
    main?: string;
    types?: string;
    engines?: {
        node?: string;
        npm?: string;
    };
    repository?: {
        type: string;
        url: string;
    };
}
interface RoboMessage {
    type: 'ready' | 'restart' | 'state-load' | 'state-save';
}
interface RoboStateMessage extends RoboMessage {
    state: Record<string, unknown>;
}
interface SpiritMessage {
    error?: unknown;
    event?: 'build' | 'get-state' | 'command' | 'ready' | 'restart' | 'set-state' | 'start' | 'stop';
    payload?: unknown;
    state?: Record<string, unknown>;
    verbose?: boolean;
}
type SageOptions = {
    defer?: boolean;
    deferBuffer?: number;
    ephemeral?: boolean;
    errorChannelId?: string;
    errorMessage?: string;
    errorReplies?: boolean;
};
type Plugin = string | [string, unknown, PluginMetaOptions?];
interface PluginData {
    name: string;
    options?: unknown;
    metaOptions?: PluginMetaOptions;
}
interface PluginMetaOptions {
    failSafe?: boolean;
}
interface BaseConfig {
    __auto?: true;
    __module?: string;
    __path?: string;
    __plugin?: {
        name: string;
        path: string;
    };
    description?: string;
    timeout?: number;
}
declare const _default: {};

export { Api as A, BaseConfig as B, ContextConfig as C, Scope as D, Event as E, FlashcoreAdapter as F, EventConfig as G, HandlerRecord as H, _default$4 as I, _default$3 as J, _default$2 as K, _default$1 as L, Manifest as M, _default as N, PackageJson as P, RoboMessage as R, SpiritMessage as S, _default$5 as _, ContextEntry as a, Context as b, MiddlewareData as c, MiddlewareResult as d, Middleware as e, MiddlewareEntry as f, RoboStateMessage as g, SageOptions as h, Plugin as i, PluginData as j, PluginMetaOptions as k, HttpMethod as l, RoboRequest as m, RoboReply as n, RouteHandler as o, ApiEntry as p, Command as q, CommandConfig as r, CommandContext as s, CommandEntry as t, CommandIntegrationType as u, CommandOption as v, CommandResult as w, CommandOptionTypes as x, CommandOptions as y, Config as z };
